
<template>
  <div style="height: 100%;" v-loading="loading_btn">
    <el-container style="min-height: 100%;">
      <el-main style="padding: 0;padding-left: 20px;">
        <ContentWrap>
          <div class="flex aic" style="flex-wrap: wrap;">
            <div class="flex aic margin-left16">
              <p class="fonts16">学历：</p>
              <el-select v-model="state.ruleForm.educationLevel" placeholder="请选择学历" style="width: 180px">
                <el-option v-for="item in state.options1" :key="item.dictValue" :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </div>
            <div class="flex aic margin-left16">
              <p class="fonts16">工作经验：</p>
              <el-select v-model="state.ruleForm.requirementsYears" placeholder="请选择工作经验" style="width: 180px">
                <el-option v-for="item in state.options2" :key="item.dictValue" :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </div>
            <div class="flex aic margin-left16">
              <p class="fonts16">到岗时间：</p>
              <el-select v-model="state.ruleForm.arrivalTime" placeholder="请选择到岗时间：" style="width: 180px">
                <el-option v-for="item in state.options3" :key="item.dictValue" :label="item.dictLabel"
                  :value="item.dictValue" />
              </el-select>
            </div>
            <!-- <div class="flex aic margin-left16">
                <p class="fonts16">招聘职位：</p>
                <el-select v-model="state.ruleForm.positionId" clearable placeholder="请选择招聘职位" style="width: 180px">
                    <el-option v-for="item in state.positionOptions" :key="item.id" :label="item.positionName"
                        :value="item.id" />
                </el-select>
            </div> -->
            <div class="flex aic margin-left16">
              <el-input v-model="state.ruleForm.seachValue" placeholder="搜索人选期望职位、所在公司" />
            </div>
            <ElButton class="margin-left16" type="primary" :icon="Search" @click="onSearch">
              查询
            </ElButton>
            <ElButton class="margin-left16" :icon="Refresh" @click="onReset">
              重置
            </ElButton>
            <!-- <div class="flex aic ">
              <p class="fonts14">简历标签：</p>
              <el-select v-model="state.input3" placeholder="请选择简历标签" style="width: 180px">
                <el-option label="Restaurant" value="1" />
                <el-option label="Order No." value="2" />
                <el-option label="Tel" value="3" />
              </el-select>
            </div> -->
          </div>
        </ContentWrap>

        <el-main
          style="background-color: #fff;min-height: calc(100% - 142px);position: relative;padding-bottom: 60px;margin-top: 20px;">
          <ListVue  :type="6" :data="state.data" @listVue="listClick" :ruleFrom="state.ruleForm" :total="state.total"/>
        </el-main>
      </el-main>
    </el-container>
  </div>
</template>
<script setup lang="tsx">
import { positionListAll } from "@/api/recruit/index"
import { getResumeList } from "@/api/personal/index"
import { ContentWrap } from '@/components/ContentWrap'
import { dictSect } from "@/utils/dictUnit"
import { ListVue } from "../Home/components/index"
import { Search, Refresh } from '@element-plus/icons-vue'
import { reactive,ref } from 'vue'
const loading_btn=ref(false)
const state = reactive({
  positionOptions:[]as any,
  listBool:false,
  input3: "",
  react: false,
  ruleForm: {
    pageSize:10,
    pageNum:1,
    orderByColumn:"",
    isAsc:"desc",
    educationLevel:"",
    requirementsYears:"",
    arrivalTime:"",
    seachValue:"",
    positionId:""
  } as any,
  total:0,
  data: [],
  options1: [] as any,//学历
  options2: [] as any,//工作经验
  options3: [] as any,//到岗时间
})
// 方法区--------------------------------------------------------------------
// nav方法回传
// 查询
const onSearch = () => {
  console.log("查询");
  getResumeListApi(state.ruleForm)
}

// 重置
const onReset = () => {
  console.log("重置");
  state.ruleForm.pageNum=1
  state.ruleForm.educationLevel=""
  state.ruleForm.requirementsYears=""
  state.ruleForm.arrivalTime=""
  state.ruleForm.seachValue=""
  getResumeListApi(state.ruleForm)
}

const listClick = (value: any) => {
  console.log("参数:",value);
  
  state.ruleForm=value
  getResumeListApi(state.ruleForm)
}
function info() {
  state.options1 = dictSect("education")
  state.options2 = dictSect("requirements_years")
  state.options3 = dictSect("arrival_time")
}
info()
// 方法结束------------------------------------------------------------------
const getResumeListApi = async (params) => {
  loading_btn.value=true
  await getResumeList(params).then((res: any) => {
    console.log("人才推送:", res);
    loading_btn.value=false
    state.total=res.total
    state.data=res.rows
  })
}
getResumeListApi(state.ruleForm)
const positionListAllApi = async () => {
    await positionListAll().then(res => {
        console.log("全部职位", res);
        state.positionOptions = res.data
    })
}
positionListAllApi()
</script>
<style lang="less" scoped>
.margin-left16 {
  margin-left: 16px;
  margin-bottom: 16px;

}
</style>